<template>
  <div id="tab-com">
    <slot name="head" :info="info">
      默认头部信息
    </slot>
    子组件按钮
    <el-button @click="numJan">--</el-button>
    <el-button @click="addNum">++</el-button>
    <slot name="foot">
      默认尾部信息
    </slot>
    <!-- <el-input v-model="inputValue"></el-input> -->
    <!-- <hello-world></hello-world> -->
  </div>
</template>

<script type="text/javascript">
// import HelloWorld from '@/components/HelloWorld.vue'
export default {
  name: "TabComp",
  // components: {HelloWorld},
  props: {
    value: {
      type: Number,
      default: 0
    },
    // msg: String,
  },
  beforeCreate() {
    console.log('child3')
  },
  created() {
    console.log('child4')
    
  },
  beforeMount() {
    console.log('child5')

  },
  mounted() {
    console.log('child6')
    
  },
  beforeUpdate() {
    console.log('child更新之前')
  },
  updated() {
    console.log('child更新之后')
  },
  beforeDestroy() {
    console.log('child7')

  },
  destroyed() {
    console.log('child8')
  },
  data() {
    return {
      inputValue: '1',
      info: '子组件的头部数据',
      obj: {
        flag: 1,
        tag: 'div',
        attr:[{name: 'id',value: 'page-a'}],
        children:[
          {tag: 'Text',value: '子组件按钮'}
        ],
        age: '30',
        sex: '男',
        car: "GSX"
        //等等等等
      }
    }
  },
  methods: {
    numJan() {
      // this.$even
      console.log(this.value)
      this.$emit('input')
    },
    addNum() {
      this.$eventbus.$emit('addNumber', 10)
    }
  }
}
</script>

<style lang="scss" scoped></style>